package com.kycxika.app;

import android.app.Application;
import android.content.Context;
import com.kycxika.app.dbutils.IntImp.ConfigureManager;
import com.kycxika.app.dbutils.IntImp.RetrofitUtils;
import com.kycxika.app.utils.HttpApiConst;


/**
 * Created by DELL on 2017/5/3.
 */
public class KycXikaApplication extends Application {
    public static Context context;
    private static KycXikaApplication instance;

    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
        instance = this;
        ConfigureManager.getConfigureManager().setOkhttpCache(true);//设置okhttp是否缓存
        RetrofitUtils.initRetrofit(HttpApiConst.kycxkBaseDomain);
    }

    public static KycXikaApplication getInstance() {
        if (instance == null) {
            throw new NullPointerException("WinApplication instance is null, please register in AndroidManifest.xml first");
        }
        return instance;
    }

    /**
     * 获取上下文
     *
     * @return Context
     */
    public static Context getContext() {
        return context;
    }
}
